import java.util.concurrent.Callable;

public class MyCallable implements Callable<String> {

    private final int n;

    public MyCallable(int n) {
        this.n = n;
    }

    @Override
    public String call() throws Exception {
        int sum = 0;
        for (int i = 1; i < n; i++) {
            sum += i;
        }
        final String threadName = Thread.currentThread().getName();
        return String.format("%s求出了1->%d的和是：%d", threadName, n, sum);
    }
}
